add_subdirectory(fc)
add_subdirectory(sparsehash)
add_subdirectory(chainbase EXCLUDE_FROM_ALL)
add_subdirectory(utilities)
add_subdirectory(appbase EXCLUDE_FROM_ALL)

set(WITH_GFLAGS OFF CACHE BOOL "build RocksDB with GFlags" FORCE)
set(WITH_LZ4 ON CACHE BOOL "build RocksDB with LZ4" FORCE)
set(WITH_ZSTD ON CACHE BOOL "build RocksDB with zstd" FORCE)
set(WITH_TESTS OFF CACHE BOOL "build RocksDB with Tests" FORCE)
set(WITH_TOOLS OFF CACHE BOOL "build RocksDB with Tools" FORCE)
set(WITH_TBB ON CACHE BOOL "build RocksDB with TBB" FORCE)
set(PORTABLE ON CACHE BOOL "build a portable RocksDB library" FORCE)
set(USE_RTTI ON CACHE BOOL "use RTTI in RocksDB" FORCE)

add_subdirectory(rocksdb EXCLUDE_FROM_ALL)
set_property(TARGET rocksdb PROPERTY CXX_STANDARD 17)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
        set_property(TARGET rocksdb PROPERTY COMPILE_FLAGS "-Wno-class-memaccess")
    endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
        set_property(TARGET rocksdb PROPERTY COMPILE_FLAGS "-Wno-shadow")
    endif()
endif()

add_subdirectory(chain)
add_subdirectory(catch)
add_subdirectory(testing)
add_subdirectory(fmt EXCLUDE_FROM_ALL)
